define(['util', 'ajax'], function (util, ajax) {
    "use strict";

    var exports = {}, ViewModel;

    ViewModel = function () {
        var self = this;

        self.email = ko.observable();

        self.addNewsLetter = function () {
            var form = {
                Email: self.email(),
            };

            ajax.post('Newsletter', form).done(function (response) {
                if (response.isSuccess == true) {
                    self.email('');
                    util.notify.info(response.message);
                }
            });
        };
    };

    exports.exec = function (sectionId) {
        var viewModel = new ViewModel();
        ko.applyBindings(viewModel, document.getElementById(sectionId));
    };

    return exports;
});